#include "main.h"
#include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;

void display()
{
	Node* p = g_head;
	while (p != NULL)
	{
		Node* pp = p;
		while (pp != NULL)
		{
			cout << setw(4) << pp->key;
			pp = pp->next;
		}
		cout << endl;
		p = p->down;
	}
}

int main(int argc, char **argv)
{
	srand((unsigned int)time(NULL));
	
	int array[] = {1, 2, 3, 5, 4, 9, 0, 8, 7, 6, 10, 18, 17, 11, 19, 16, 13, 14, 12, 15, 20, 22, 21, 24, 23, 26, 25, 28, 27, 29};
	int len = sizeof(array) / sizeof(int);
	
	for (int i = 0; i < len; ++i)
	{
		insert(array[i], array[i] + 1);
	}
	display();
	
	cin.get();
	return 0;
}
